const query = {
    /**
     * s: startTime
     * e: endTime
     * b: database
     * z: ztlxs
     */
    xsqk: (s, e, b, z) => {
        return z ?
            `
        SELECT
            Arrivate_Date,
            Sum(ybrs) AS ybrs__sum,
            Sum(gpje) AS gpje__sum,
            tdlx 
        FROM
            ${b} 
        WHERE
            ztlxs LIKE '%${z}%' AND 
            Arrivate_Date BETWEEN '${s}' AND '${e}' 
        GROUP BY
            Arrivate_Date,
            tdlx;
        ` :
            `
        SELECT
            Arrivate_Date,
            Sum(ybrs) AS ybrs__sum,
            Sum(gpje) AS gpje__sum,
            tdlx 
        FROM
            ${b} 
        WHERE
            Arrivate_Date BETWEEN '${s}' 
            AND '${e}' 
        GROUP BY
            Arrivate_Date,
            tdlx;
        `
    },
    mpxsqk: (s, e, b, z) => {
        return z ? 
        `
        SELECT
            ygjd,
            Sum(ybrs) AS ybrs__sum,
            Sum(gpje) AS gpje__sum
        FROM
        ${b}
        WHERE
            tdlx LIKE '%单购门票%' AND
            Arrivate_Date BETWEEN '${s}' AND '${e}' AND
            ztlxs LIKE '%${z}%'
        GROUP BY
            ygjd
        ORDER BY
            Sum(ybrs) DESC;
        ` :
        `
        SELECT
            ygjd,
            Sum(ybrs) AS ybrs__sum,
            Sum(gpje) AS gpje__sum
        FROM
        ${b}
        WHERE
            tdlx LIKE '%单购门票%' AND
            Arrivate_Date BETWEEN '${s}' AND '${e}' 
        GROUP BY
            ygjd
        ORDER BY
            Sum(ybrs) DESC;
        `
    }
}

module.exports = query;